/* Copyright (c) 2004-2024 Peigen.info. All rights reserved. */

package info.peigen.hotpot.demo.scheduler.service.step.processor.robot;

import info.peigen.hotpot.demo.scheduler.service.step.base.AbstractStepProcessor;
import info.peigen.hotpot.demo.scheduler.service.step.base.TaskContext;
import lombok.extern.slf4j.Slf4j;
import org.noear.solon.annotation.Component;

/**
 * <b>(RobotSelectProcessor)</b>
 * 机器人计算处理器
 *
 * @author LiHai
 * @version 1.0.0
 * @since 2023/9/10
 */
@Slf4j
@Component
public class RobotSelectProcessor extends AbstractStepProcessor {
    @Override
    public void execute(TaskContext context) {
        //log.info("同步：【localService.findRobot(Idle)】");
        // 同步调用时，查询结果入库，显式调用completed
        // context.getTask().getStepResult().setRobotId("robot001");
        // super.completed(context);
        context.getTask().getSendRequestNo().add(context.getTask().getTaskId() + "-calc");
        log.info("异步：【robotCommandService.calc({})】", context.getTask().getStepResult().getRobotId());

    }

    @Override
    public void callback(TaskContext taskContext) {
        // String referMachineId = taskContext.getCallBackResult().getReferMachineId();
        // // 持久化
        // taskContext.getTask().getStepResult().setRobotId(referMachineId);
    }
}
